package com.example;



public class Demo {

	/**
	 * 有不同类型的门，调用其方法实现功能
	 */
	public static void main(String[] args) {
		FangDaoMen f=new FangDaoMen();
		OpenTheDoor openTheDoor=new OpenTheDoor();
		openTheDoor.openDoor(f);
		f.character();
	}

}

interface Door {
	void open();

	void close();
}

class FangDaoMen implements Door {

	@Override
	public void open() {
		System.out.println("防盗门开启");
	}

	@Override
	public void close() {
		System.out.println("防盗门关闭");
	}

	void character() {
		System.out.println("开门时，我会叫一下");
	}
}

class PuTongMen implements Door {

	@Override
	public void open() {
		System.out.println("普通门开启");
	}

	@Override
	public void close() {
		System.out.println("普通门关闭");
	}

}
class OpenTheDoor{
	void openDoor(Door door){
		door.open();
	}
	void closeDooe(Door door){
		door.close();
	}
}
